package com.ruoyi.livenuniappserver.api.archives.service.Impl;

import com.ruoyi.common.core.domain.CommonResult;
import com.ruoyi.livenuniappserver.api.archives.entity.Archives;
import com.ruoyi.livenuniappserver.api.archives.entity.ArchivesModel;
import com.ruoyi.livenuniappserver.api.archives.mapper.ArchivesMapper;
import com.ruoyi.livenuniappserver.api.archives.service.ArchivesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @ClassName ArchivesServiceImpl
 * @Description TODO
 * @Author 田
 * @Date 2024/2/26 14:07
 **/
@Service
public class ArchivesServiceImpl implements ArchivesService {
    @Autowired
    private ArchivesMapper archivesMapper;

    /**
    * @Author 田 
    * @Description 查询个人档案信息
    * @Date 2024/3/8 9:02
    * @Return com.zhuiyun.project.common.response.CommonResult
    * @param id
    */
    @Override
    public CommonResult selectArchives(String id) {
        Archives archives = archivesMapper.selectArchives(id);
        /*手机号加密*/
        String memberUserPhone = archives.getMemberUserPhone();
        String phone = memberUserPhone;
        //截取前三位字符
        String tou = phone.substring(0, 3);
        //定义中间四位用****表示
        String zhong = "****";
        //截取后三位字符
        String hou = phone.substring(7, 11);
        String maskphone = tou + zhong + hou;
        archives.setMaskPhone(maskphone);

        return CommonResult.ok(archives);
    }

    @Override
    public boolean updateArchives(ArchivesModel archivesModel) {
        archivesMapper.updateArchives(archivesModel);
        return false;
    }


}